package game.targets.entity.world;

import game.targets.MathFuncs;
import game.targets.entity.Entity;
import game.targets.observer.Subject;

import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.math.Vector3;

public class Player extends Entity {
	private Bow bow;
	
	public Player(Vector3 pos, PerspectiveCamera camera, Subject subject) {
		super(pos, new Vector3(0,0,0), null, subject);
		Vector3 bowPos=MathFuncs.getFrontOrBackPosition(this.getPosition(), new Vector3(1,0,0), 3);
		bow=new Bow(new Vector3(bowPos), camera, subject);
	}

	@Override
	public void update(float delta) {
		bow.update(delta);
	}
	
	@Override
    public void render(ModelBatch batch, Environment environment) {
	    super.render(batch, environment);
        bow.render(batch, environment);
    }
	
	public void fireArrow(Vector3 targetPos, float charge){
		bow.fireArrow(targetPos, charge);
		
	}

	public Bow getBow() {
		return bow;
	}

	public void setBow(Bow bow) {
		this.bow = bow;
	}

	public void charge(Vector3 dir) {
		bow.charge(dir);
		
	}
	
	public void hold(){
		bow.hold();
	}
	
	
}
